//短域名对象
(function() {
	//构造函数
	var _uuid = 0;
	var _con = function(value) {
		var self = _con.findByValue(value);
		if (self) {
			return self;
		}
		var self = this;
		self._id = db_id_prefix + Math.random().toString(32).substr(2) + (+new Date).toString(32);
		self.value = value;
		console.log("生成一个压缩索引对象：", self);
		db.insert(db_table_name, self);
		//索引用的反向存储
		db.insert(db_index_table_name, {
			_id: value,
			value: self._id
		});
	};
	//技能
	module.exports = _con;
	_con.prototype = require("./skill");
	//静态方法
	_con.get = function(Id) {
		var result = db.find_by_id(db_table_name, Id);
		return _con.getInstance(result);
	};
	_con.getInstance = function(obj) {
		if (obj) {
			obj.__proto__ = _con.prototype;
		}
		return obj;
	}
	_con.findByValue = function(value) {
		var obj = db.find_by_id(db_index_table_name, value);
		return _con.get(obj && obj.value);
	};
	var db = require("../db/index");
	var config = require("../_include/config");
	var db_table_name = config.dbname.short;
	var db_index_table_name = config.dbname.shortIndex;
	var db_id_prefix = config.dbIdPrefix.short;
}());